import React from 'react';
import { format } from '@/utils/datetime';
import CommonPage from '@/components/page/CommonPage';
import { useModel } from 'umi';
import { renderNumber } from '@/utils/common';
const daoName = 'ShXykfqzsdr';
const importName = 'ShXykfqzsdr';
const columns: API.Column[] = [
  {
    title: '操作人',
    width: 120,
    sorter: true,
    dataIndex: 'CZR',
    key: 'CZR',
    dispaly: true,
    filter: false,
    export: false,
  },
  {
    title: '操作日期',
    width: 120,
    sorter: true,
    key: 'CZRQ',
    dataIndex: 'CZRQ',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: false,
    export: false,
  },
  {
    title: '客户姓名',
    width: 120,
    sorter: true,
    dataIndex: 'KHMC',
    key: 'KHMC',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '放款时间',
    width: 120,
    sorter: true,
    dataIndex: 'FKSJ',
    render: (data) => format(data, 'yyyy-MM-dd'),
    key: 'FKSJ',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '放款金额',
    width: 150,
    sorter: true,
    dataIndex: 'FKJE',
    key: 'FKJE',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '入账收入',
    width: 150,
    sorter: true,
    dataIndex: 'RZSJ',
    key: 'RZSJ',
    dispaly: true,
    filter: true,
    export: true,
    render: (data) => renderNumber('.2f', data),
  },
  {
    title: '协同营销工号',
    width: 120,
    sorter: true,
    dataIndex: 'YXGH',
    key: 'YXGH',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '业绩统计日期',
    width: 150,
    sorter: true,
    key: 'DRRQ',
    dataIndex: 'DRRQ',
    render: (data) => format(data, 'yyyy-MM-dd'),
    dispaly: true,
    filter: true,
    export: false,
  },
];
const controls: API.Control[] = [
  { name: 'KHMC', type: 'text', label: '客户姓名', grid: 12 / 24 },
  { name: 'FKSJ', type: 'date', label: '放款时间', grid: 12 / 24 },
  {
    name: 'FKJE',
    label: '放款金额',
    rules: [{ required: false, message: '不能为空' }],
    type: 'number',
    dataType: 'number',
    grid: 12 / 24,
  },
  { name: 'RZSJ', type: 'number', label: '入账收入', grid: 12 / 24 },
  { name: 'YXGH', type: 'text', label: '协同营销工号', grid: 12 / 24 },
  { name: 'DRRQ', dataType: 'date', type: 'date', label: '业绩统计日期', grid: 12 / 24 },
];
const ShXykfqzsdrForm: React.FC = () => {
  const { user } = useModel('@@initialState', (ret) => {
    return {
      user: ret.initialState?.user,
    };
  });
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="信用卡分期中收导入"
      importName={importName}
      importControls={controls}
      keyColName={'ID'}
      importMode="DeleteAfterInsert"
      importParamNames={['DRRQ']}
      importParamVals={{ CZRID: '' + user?.userID, CZR: user?.name }}
      importTemplateName="信用卡分期中收导入模板"
      initSorter={{ FieldName: 'CZRQ', Direction: 'DESC' }}
    />
  );
};

export default ShXykfqzsdrForm;
